<template>
    <div class="container">
        <!-- 内容区域 -->
        <div class="screen" ref="screen">
            <div class="top">
                <Top />
            </div>
            <div class="bottom">
                <div class="left">1</div>
                <div class="center">2</div>
                <div class="right">3</div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import Top from './components/top/index.vue'
import { onMounted, ref } from 'vue'
const screen = ref()
onMounted(() => {
    const scale = getScale()
    screen.value.style.transform = `scale(${scale}) translate(-50%, -50%)`
})
const getScale = (w = 1980, h = 1080) => {
    const ww = window.innerWidth / w
    const wh = window.innerHeight / h
    return ww < wh ? ww : wh
}
window.onresize = () => {
    const scale = getScale()
    screen.value.style.transform = `scale(${scale}) translate(-50%, -50%)`
}
</script>

<style scoped lang="scss">
.container {
    width: 100vw;
    height: 100vh;
    background: url('./images/bg.png') no-repeat;
    background-size: cover;

    .screen {
        position: fixed;
        top: 50%;
        left: 50%;
        width: 1920px;
        height: 1080px;
        transform-origin: left top;

        .top {
            width: 100%;
            height: 40px;
        }

        .bottom {
            display: flex;

            .right {
                flex: 1
            }

            .left {
                flex: 1;
            }

            .center {
                flex: 2;
            }
        }
    }
}
</style>
